package com.lry.basic.redis;

import com.alibaba.fastjson.JSON;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;
import redis.clients.jedis.Jedis;

import java.util.ArrayList;

@TestInstance(TestInstance.Lifecycle.PER_CLASS)
public class HyperLogLogApply {

    private Jedis jedis;

    @BeforeAll
    public void before() {
        jedis = RedisPool.getJedis();
    }

    @AfterAll
    public void after() {
        RedisPool.release(jedis);
    }


    @Test
    public void testHyperLogLog(){
        for(int i=0;i<1000000;i++){
            jedis.pfadd("pf",""+i);
        }
        System.out.println(jedis.pfcount("pf"));
    }

}
